﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;

using System.Windows.Forms;

namespace Qiguan
{
    public partial class MainForm : Form
    {
        public Timer timer = new Timer();

        public MainForm()
        {
            InitializeComponent();

            //这个定时器用来定期刷新UI面板
            this.timer.Interval = 500;
            timer.Tick += show;
            timer.Start();

            //默认阵型选择
            comboBox1.SelectedIndex = comboBox1.Items.IndexOf("单横阵");

        }

        private void label1_Click(object sender, EventArgs e)
        {

        }

        private void label2_Click(object sender, EventArgs e)
        {

        }

        //刷新UI面板
        public void show(object sender, EventArgs e)
        {
            label2.Text = "累计脚本执行次数:"+ Program.zhayu_num;

            if (!Program.info.Equals(""))
            {
                lock (Program.info)
                {
                    richTextBox1.AppendText("\n" + Program.info);
                    richTextBox1.HideSelection = false;
                    Program.info = "";
                }
            }
        }



        private void label4_Click(object sender, EventArgs e)
        {

        }

        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            switch (comboBox1.SelectedItem.ToString()) //获取选择的内容
            {

                case "单纵阵":
                    Program.formation = "Formation1";
                    break;

                case "复纵阵":
                    Program.formation = "Formation2";
                    break;

                case "轮形阵":
                    Program.formation = "Formation3";
                    break;

                case "梯形阵":
                    Program.formation = "Formation4";
                    break;

                case "单横阵":
                    Program.formation = "Formation5";
                    break;

            }

            Program.show_info("切换阵型为"+ comboBox1.SelectedItem.ToString()+"!");
        }

        private void MainForm_Load(object sender, EventArgs e)
        {

        }
    }
}
